package wqh.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import wqh.domain.AlarmInComming;

import java.util.List;

/**
 * Created by devts on 2016/9/28.
 */
public interface AlarmInCommingDao {

    @Insert("INSERT INTO alarm_incomming (ip, up_x, type, addr, dev_type, dev_addr, dev_status, confirm_status,alarm_time) VALUES(" +
            "#{ip}, #{up_x}, #{type}, #{addr}, #{dev_type}, #{dev_addr}, #{dev_status}, #{confirm_status}, #{alarm_time})")
    int insertRecord(AlarmInComming alarmInComming);

    @Delete("DELETE FROM alarm_incomming WHERE id = #{1}")
    int deleteRecord(Integer id);

    @Select("SELECT * FROM alarm_incomming")
    List<AlarmInComming> findAllRecord();

    @Select("SELECT * FROM alarm_incomming WHERE id = #{1}")
    AlarmInComming findAllById(Integer id);

    List<AlarmInComming> findAllStatus(String status);

    List<AlarmInComming> findAllStatusAndTime(String status,Integer unix_time);

    int countAllStatus(String status);

    int countAll();

    int deleteAll();

}
